#ifndef DEXPANEL_H
#define DEXPANEL_H

#include <QMainWindow>
#include <QHash>

class QAction;
class QMenu;
class QString;

class DexPanelBtn;

#include <X11/Xlib.h>
#include <X11/Xatom.h>

namespace Ui
	{
		class DexPanel;
	}

class DexPanel : public QMainWindow
	{
		Q_OBJECT

		public:
			enum Position {
				LEFT,
				RIGHT,
				TOP,
				BOTTOM
			};

			DexPanel(QWidget * parent = 0, Qt::WindowFlags f = 0);
			~DexPanel();

			void addClientButton(Window);
			void clearPressedDown();
			void removeClientButton(Window);
			void setButtonPressed(Window, bool);
			void setPosition(Position);
			void updateBtnText(Window);

		protected:
			virtual QString getProgramIcon(QString, QString dir = "apps") const;
			virtual QString getWindowName(Window) const;

		private:
			void constructMenus();
			void genAppsMenus();

			Atom d_NET_WM_STRUT_PARTIAL;
			Atom d_NET_WM_STRUT;
			Ui::DexPanel *ui;
			bool hasMenuVisible;
			QHash<QString, QMenu*> menus;
			QHash<Window, DexPanelBtn*> clientBtns;

		private slots:
			void execApp(QAction*);
			void logout();
			void runDialog();
			void setHasMenuVisible()
				{ hasMenuVisible = true; }
			void unsetHasMenuVisible()
				{ hasMenuVisible = false; }
	};

#endif // DEXPANEL_H
